home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
reform12.zip
/
REFORM12.DOC
< prev
next >
Wrap
Text File
|
1987-05-23
|
7KB
|
144 lines
15 apr 1986 Reformat - 1 -
REFORMAT: an original JOS disk tool.
Version 1.21TH
Use this program as follows:
REFORMAT {d:} where d: is the drive containing the disk to be
reorganized. If d: is omitted, the default drive is selected.
REFORMAT ? will present a helpscreen.
The performance of disk I/O becomes bad when when a disk has been
used for a long time, because files will not be contiguous, and files
that are used concurrently will not be in adjacent parts of the disk.
Files on often used disk ( floppy or fixed ) tend to become scattered
all over the disk. Not only files that are several times extended, but
after a while also new files will not be contiguous, when created.
Consider a disk with a lot of files. Erasing a number of small files
will free clusters that are randomly distributed among the occupied
clusters, so a new larger file will be broken up in a lot of small
pieces. For files that are read sequentially this is only a small loss
of efficiency, but when reading or writing a random acces file like a
database, performance is very low. Not only head movements from one
from one cluster to another will have a bad effect on performance.
Since in DOS 2.xx not the total FAT is kept in memory, accessing a
widely scattered file might cause extra head movement when DOS has to
read another part of the FAT.
A program reading or writing more than one file at random will
suffer from bad I/O performance if the files are not close together
on the disk. The subdirectory facility under DOS only provides a kind
of 'administrative adjacency', not physical adjacency.
This all is important for fixed disks in the first place, but for
floppy disks also, because head movements on floppy disk drives are
rather slow, as is the head settling time.
To solve this problem I have written the *REFORMAT* program.
REFORMAT will look at all files on a disk, both in the root directory
and in all subdirecties, to find out whether they are contiguous. If
at least one file (or subdirectory) is found to be not contiguous a
complete reorganization of the disk is done.
This reorganization consists of the following:
1) Root directory and all subdirectories are cleaned of erased entries.
This should optimize the time DOS needs to find an entry,
especially in directories that contain a great deal of erased
files. The order of entries in a (sub)directory is never changed.
15 apr 1986 Reformat - 2 -
2) All files are made contiguous.
3) Files and subdirectories are moved, as far as necessary:
Every (sub)directory is immediately followed by all the files it
owns, followed by all the subdirectories it is parent of. Using the
last sentence recursively, the place of every file on the disk is
determined now.
Due to the algorithm used, the order in which subdirectories are
written to disk is the reversed of the order in which they appear
in the parent directory. The order for the files is never changed.
Placing all files in a subdirectory closely together on disk minimizes
head movements when accessing mulptiple files in a program: place them
in the same subdirectory, and after REFORMAT they are physically close
together on the disk.
REFORMAT presents a screen with information about the disk and the
files. The number of dataclusters to be moved is also presented. This
number will in some cases be greater than the number of used clusters.
This is not an error, but it is necessary to move unused clusters that
appear between the used clusters.
* WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING *
NEVER, NEVER run REFORMAT on a disk that contains protected software,
because it could ruin part of the protection scheme, or even the whole
disk. Some disk optimizers leave hidden files on a disk unaffected.
REFORMAT affects *ALL* files, regardless of their attributes. Leaving
hidden files unaffected is not always save with regard to protected
software. Since there are a number of programs that easily change file
attributes, files meant to be hidden may have been made unhidden.
(I have seen IBMBIO.COM and IBMDOS.COM on some disks with a normal DIR
command). Therefore: protected software should *ALWAYS* be removed
from a disk (UNINSTALL or something like that) before running REFORMAT.
In case you run REFORMAT on a fixed disk, the program will prompt you
to confirm that no protected software is on the disk, just before the
actual reformatting wil start.
* * * * * * * * * * * * * *
Although much effort has been spent to create a reliable program, it
is strongly recommended that you make a backup of your disk before you
run REFORMAT. A crash during REFORMATting will render your disk either
partially or totally unusable. In case of a read or write error, the
program prompts you with the question whether to Abort, Retry, or
Ignore the error. The Ignore option is available only after a change
to the disk has been made by the program. Always try some Retries,
15 apr 1986 Reformat - 3 -
before going to Ignore. The Ignore option is provided to minimize the
loss of data: since data are read and written one cluster at a time,
an Ignore will cause only one cluster to be lost. (Depending on disk-
type, 1 to 4 Kb). An Abort will probably always cause a lot of data
to be lost. (They are still on the disk, however, so it is possible to
find them using a program like the NORTON utilities).
One of the future expansions of the program will be an automatic
recovery facility, by logging changes made to the disk on another
drive.
* * * * * * * * * * * * * *
This program is donated to the public domain. No charge is asked
if you use it, but it may not be used in a commercial environment, nor
may you charge a fee for its use or for a copy of it. Commercial users
please contact me at the address below.
Comments, bugs etc. should be send to
Jos Wennmacker
Universitair Rekencentrum
Geert Grooteplein Zuid 41
NL 6525 GA Nijmegen
The Netherlands.
* * * * * * * * * * * * * *
To run the program if you did not download or copy a REFORMAT.COM file
proceed as follows:
1) Run TURBO-PASCAL
a) go to the Option screen,
select C (com file to be generated when compiling)
select I (mInimum free dynamic memory)
enter 1000. This will ensure there is always
enough room on the heap for about 1000 files.
[Toad Hall Note: With approximately 200Kb of free RAM, this
code compiles perfectly with NO special ("I") options selected.]
Quit the options screen.
b) compile REFORMAT.PAS. REFORMAT.INC should be on the logged
drive; if it is not, change the line where it is included.
8) Quit TURBO.
9) You can now run REFORMAT.